package avicit.bdp.dms.dss.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;


/**
 * 数据资源申请表实体
 */
@ApiModel(value = "DssSubscribeDTO", description = "数据资源申请表")
@Table(name = "bdp_dss_subscribe")
public class DssSubscribeDTO extends BaseDTO {

    /**
     * 主键
     */
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @Column(name = "id")
    @Id
    @javax.persistence.Id
    private String id;

    /**
     * 数据资源id
     */
    @LogField
    @ApiModelProperty(value = "数据资源id")
    @FieldRemark(column = "dataResourceId", field = "dataResourceId", name = "数据资源id")
    @Column(name = "data_resource_id")
    private String dataResourceId;

    /**
     * 用户id
     */
    @LogField
    @ApiModelProperty(value = "用户id")
    @FieldRemark(column = "userId", field = "userId", name = "用户id")
    @Column(name = "user_id")
    private String userId;

    /**
     * 申请说明
     */
    @LogField
    @ApiModelProperty(value = "申请说明")
    @FieldRemark(column = "applyOpinion", field = "applyOpinion", name = "申请说明")
    @Column(name = "apply_opinion")
    private String applyOpinion;

    /**
     * 审核状态 0-未申请 1-已申请 2-已通过 3-未通过
     */
    //@LogField
    @ApiModelProperty(value = "审核状态 0-未申请 1-已申请 2-已通过 3-未通过 ")
    //@FieldRemark(column = "auditStatus", field = "auditStatus", name = "审核状态 0-未申请 1-已申请 2-已通过 3-未通过 ")
    @Column(name = "audit_status")
    private Integer auditStatus;

    /**
     * 审核人
     */
    //@LogField
    @ApiModelProperty(value = "审核人")
    //@FieldRemark(column = "auditBy", field = "auditBy", name = "审核人")
    @Column(name = "audit_by")
    private String auditBy;

    /**
     * 审核时间
     */
    //@LogField
    @ApiModelProperty(value = "审核时间")
    //@FieldRemark(column = "auditDate", field = "auditDate", name = "审核时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "audit_date")
    private Date auditDate;

    /**
     * 审核备注
     */
    @LogField
    @ApiModelProperty(value = "审核备注")
    @FieldRemark(column = "auditOpinion", field = "auditOpinion", name = "审核备注")
    @Column(name = "audit_opinion")
    private String auditOpinion;

    @Transient
    private String userName;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDataResourceId() {
        return dataResourceId;
    }

    public void setDataResourceId(String dataResourceId) {
        this.dataResourceId = dataResourceId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Integer getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(Integer auditStatus) {
        this.auditStatus = auditStatus;
    }

    public String getAuditBy() {
        return auditBy;
    }

    public void setAuditBy(String auditBy) {
        this.auditBy = auditBy;
    }

    public Date getAuditDate() {
        return auditDate;
    }

    public void setAuditDate(Date auditDate) {
        this.auditDate = auditDate;
    }

    public String getAuditOpinion() {
        return auditOpinion;
    }

    public void setAuditOpinion(String auditOpinion) {
        this.auditOpinion = auditOpinion;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getApplyOpinion() {
        return applyOpinion;
    }

    public void setApplyOpinion(String applyOpinion) {
        this.applyOpinion = applyOpinion;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "服务订阅模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "服务订阅";
        } else {
            return super.logTitle;
        }
    }

    @Override
    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

}
